package com.ymttest.database.sqlwapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.utils.EnvSetup;

public class YmtCreditDetailWapper {
	SqlManager manage;

	public YmtCreditDetailWapper() {
		manage = new SqlManager("ymt" + EnvSetup.getEnv());
	}

	/**
	 * 根据orderId查找记录集
	 * 
	 * @return
	 */
	public List<Map> selectCreditDetailByOrderId(Integer orderId) {
		List<Map> list = manage
				.getSelectResults(
						"com.ymttest.database.mapping.YmtCreditDetailMapper.selectCreditDetailByOrderId",
						orderId);
		return list;
	}
	
	/**
	 * 
	 * @param queryField 查询的字段
	 * @param joinCondition 连表查询
	 * @param queryCondition 查询条件
	 * @return
	 */
	public List<Map> selectCreditDetail(String queryField, String joinCondition, String queryCondition) {
		Map m = new HashMap();
		if(null != queryField && !"".equals(queryField)){
			m.put("queryField", queryField);
		}
		if(null != joinCondition && !"".equals(joinCondition)){
			m.put("joinCondition", joinCondition);
		}
		if(null != queryCondition && !"".equals(queryCondition)){
			m.put("queryCondition", queryCondition);
		}
		return (List<Map>) manage.getSelectResults(
				"com.ymttest.database.mapping.YmtCreditDetailMapper.selectCreditDetail", m);
	}

	public void close() {
		manage.close();
	}
	
	public static void main(String[] args) {
		Logger.debug(new YmtCreditDetailWapper().selectCreditDetail(" top 1 *", null, " 1=1 "));
	}
}
